/**
 * 
 */
package com.explgo.backend.domain;

import java.util.LinkedList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.OneToMany;

/**
 * @author Jialiang(Cain) Wang
 * 
 */
@Entity
public class PlanDay extends DescribableEntity {
	private static final long serialVersionUID = 4464966940639730637L;

	private List<TimeFrame> timeFrames = new LinkedList<>();
	
	public PlanDay() {
		addTimeFrame(TimeFrame.MORNING);
		addTimeFrame(TimeFrame.AFTERNOON);
		addTimeFrame(TimeFrame.EVENING);
		addTimeFrame(TimeFrame.NIGHT);
	}
	
	private void addTimeFrame(String name) {
		TimeFrame timeFrame = new TimeFrame();
		timeFrame.setName(name);
		
		timeFrames.add(timeFrame);
	}

	/**
	 * @return the timeFrames
	 */
	@OneToMany(cascade = { CascadeType.ALL })
	public List<TimeFrame> getTimeFrames() {
		return timeFrames;
	}

	/**
	 * @param timeFrames
	 *            the timeFrames to set
	 */
	public void setTimeFrames(List<TimeFrame> timeFrames) {
		this.timeFrames = timeFrames;
	}

}
